package com.ayu.scalalearn.chapter06

/**
  * @Author 徐林玉
  * @Description Test08Object
  * @Date 2022/7/29 11:18
  * @Version 1.0
  */
object Test08Object {

  def main(args: Array[String]): Unit = {

    var p1: PersonTest08 = PersonTest08("ayu", 18)



    p1.hello()
  }

}


class PersonTest08 private (var name: String, var age: Int) {


  def hello(): Unit = {

    println(" im " + name + " age " + age + " and school is " + PersonTest08.school)
  }

}


//伴生对象
object PersonTest08 {


  private val school: String = "ayu university"

  def apply(name: String, age: Int): PersonTest08 = new PersonTest08(name, age)
}
